package day_2022_7_to_8.day48;

/**
 * @author haomin
 * @date 2022/08/21 08:50
 **/
public class Day36_1_Num1455_IsPrefixOfWord {
    class Solution {
        public int isPrefixOfWord(String sentence, String searchWord) {
            String[] words = sentence.split(" ");
            for(int i = 0;  i < words.length; ++i){
                if(words[i].startsWith(searchWord))
                    return i+1;

            }
            return -1;
        }
    }
}